<?php namespace App\Http\Controllers\Api\Admin;

use App\Http\Controllers\Controller;
use App\Http\Services\UserManager;
use App\User;
use Blocktrail\CryptoJSAES\CryptoJSAES;
use Illuminate\Http\Request;

class UserController extends Controller
{
    public function getUserToken(Request $request){
        $userId = !is_null($request->get('user_id')) ? $request->get('user_id') : 0;

        /** @var User $thisUser */
        $thisUser = User::whereId($userId)->first();

        $token = CryptoJSAES::encrypt($thisUser->wx_openid,env("AES_KEY"));

        return response()->json(['level' => 'success','message' => '获取成功','data' => $token]);
    }
}